#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <unordered_map>

using namespace std;

class Solution {
public:
    bool isNStraightHand(vector<int>& hand, int groupSize) {
        if (hand.size() % groupSize != 0) {
            return false;
        }
        
        sort(hand.begin(), hand.end());
        unordered_map<int, int> handMap;
        for (const auto& elem : hand) {
            handMap[elem]++;
        }

        for (int idx = 0; idx < hand.size(); idx++) {
            if (handMap[hand[idx]] == 0) {
                continue;
            }

            for (int loop = 0; loop < groupSize; loop++) {
                if (handMap[hand[idx] + loop] == 0) {
                    return false;
                }
                handMap[hand[idx] + loop]--;
            }
        }
        return true;
    }
};

int main()
{
    Solution s;
    vector<int> vt{ 2,1 };
    cout << boolalpha << s.isNStraightHand(vt, 2) << endl;
    return 0;
}